source(here::here("code/load.R"))

# Note: scan says SE, but article says ES, and I'm pretty sure those are
# estimates not standard errors (vab).

here("data/meta_analyses_raw/LuLinWan2019/11266_2019_93_Fig2_HTML.csv") |>
    read_csv() |>
    mutate(meta_id = "LuLinWan2019",
           subfield = "PA",
           study_year = gsub(".*(\\d{4}).*", "\\1", Study),
           study_year = as.numeric(study_year),
           estimate = as.numeric(gsub(" \\(.*", "", ES_95CI)),
           conf.low = as.numeric(gsub(".*\\((.*),.*", "\\1", ES_95CI)),
           conf.high = as.numeric(gsub(".*, (.*)\\)", "\\1", ES_95CI)),
           std.error = (conf.high - conf.low) / 3.92,
           dv = Variable,
           overall_effect = "no",
           question = "Does a More Diversified Revenue Structure Lead to Greater Financial Capacity and Less Vulnerability in Nonprofit Organizations?") |>
    select(meta_id,
           subfield,
           study_id = Study,
           study_year = study_year,
           estimate,
           std.error,
           conf.low,
           conf.high,
           dv,
           question,
           overall_effect) |>
    write_csv(here("data/meta_analyses_clean/LuLinWan2019.csv"))
